package com.lframework.xingyun.basedata.mappers;

import cn.hutool.core.util.StrUtil;
import com.lframework.starter.web.core.mapper.BaseMapper;
import com.lframework.xingyun.basedata.entity.ProductSpecCostDetail;
import com.lframework.xingyun.basedata.vo.product.speccost.QueryProductSpecCostDetailVo;

import java.util.List;

/**
 * <p>
 * 商品规格成本明细 Mapper 接口
 * </p>
 *
 */
public interface ProductSpecCostDetailMapper extends BaseMapper<ProductSpecCostDetail> {

    /**
     * 查询列表
     * @param vo
     * @return
     */
    default List<ProductSpecCostDetail> query(QueryProductSpecCostDetailVo vo) {
        return defaultJoinWrapper()
                .eq(ProductSpecCostDetail::getMainProductId, vo.getMainProductId())
                .eq(StrUtil.isNotBlank(vo.getPropertyId()), ProductSpecCostDetail::getPropertyId, vo.getPropertyId())
                .eq(StrUtil.isNotBlank(vo.getItemId()), ProductSpecCostDetail::getItemId, vo.getItemId())
                .eq(StrUtil.isNotBlank(vo.getSourceProductId()), ProductSpecCostDetail::getSourceProductId, vo.getSourceProductId())
                .list();
    }
}

